package Collection;

import java.util.*;

public class Practice {
    public static void main(String[] args) {
        Collection<String> c=new ArrayList<>();
        c.add("hello");
        c.add("#");
        c.add("one");
        c.add("two");
        c.add("three");

        Iterator<String> it=c.iterator();
        while (it.hasNext()){
            String str= it.next();
            System.out.println(str);
            if ("#".equals(str)){
                it.remove();
            }
        }
        for (String str:c){
            System.out.println(str);
        }

        String[] arrey=c.toArray(new String[0]);
        System.out.println(Arrays.toString(arrey));

        String[] arrey1={"one","two","three","four","five"};
        System.out.println(Arrays.toString(arrey1));

        List<String> list= Arrays.asList(arrey1);
        System.out.println(list);

        arrey1[1]="2";
        System.out.println(Arrays.toString(arrey1));

        list.set(2,"change");
        System.out.println(Arrays.toString(arrey1));



      /*

        List<String> list=new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        list.add("five");
        list.add("two");
        System.out.println(list);

        Set<String> set=new HashSet<>();
        set.addAll(list);
        System.out.println(set);




       Collection<String> c=new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        System.out.println(c);
        System.out.println(c.size());
        System.out.println(c.isEmpty());

        String b="one";
        boolean contains=c.contains(b);
        System.out.println(contains);

        c.remove(b);
        System.out.println(c);


        c.clear();
        System.out.println(c.size());
        System.out.println(c.isEmpty());

        Collection<Integer> c1=new ArrayList<>();
        c1.add(1);
        c1.add(2);
        c1.add(3);
        c1.add(4);
        c1.add(5);
        System.out.println(c1);

        Collection<Integer> c2=new ArrayList<>();
        c2.add(6);
        c2.add(7);
        c2.add(8);
        c2.add(9);
        c2.add(0);
        System.out.println(c2);

        c1.addAll(c2);
       boolean contain= c1.containsAll(c2);
        System.out.println(contain);
        c1.retainAll(c2);
        System.out.println(c1);
        c1.removeAll(c2);
        System.out.println(c1);


       */
    }
}
